function GtrCustomer(prefix, tableRow, item, options) {
  this._prefix = prefix;
  this._tableRow = tableRow;
  this._item = item;
  
  this._user = (options && options.user) ? options.user : null;
  
  this._createElements();
};

GtrCustomer.prototype._createElements = function() {
  var tableCell, tr, td, table, span, img, a, itr, itd, itable;
  tableCell = this._tableRow.insertCell(-1);
  tableCell.style.textAlign = 'center';
  tableCell.style.width = '835px';
  tableCell.style.height = '248px';
  
  var top = document.createElement('table');
  top.style.backgroundImage = 'url(images/pageasst/pagecustomers/topbg.png)';
  top.style.backgroundRepeat = 'no-repeat';
  top.style.width = '831px';
  top.style.height = '15px';
  top.cellPadding = 0;
  top.cellSpacing = 0;
  tableCell.appendChild(top);
  
  table = document.createElement('table');
  table.style.backgroundImage = 'url(images/pageasst/pagecustomers/middlebg.png)';
  table.style.backgroundRepeat = 'repeat-y';
  table.style.width = '831px';
  table.style.height = '220px';
  table.cellPadding = 0;
  table.cellSpacing = 0;
  tableCell.appendChild(table);
  
  tr = table.insertRow(-1);
  td = tr.insertCell(-1);
  td.style.width = '33px';
  var attr = document.createElement('img');
  attr.src = 'images/pageasst/pagecustomers/attribute.png';
  td.appendChild(attr);
  td = tr.insertCell(-1);
  td.style.height = '30px';
  td.style.textAlign = 'left';
  td.style.verticalAlign = 'middle';
  a = document.createElement('a');
  a.href = '#';
  a.style.fontSize = '18px';
  a.style.color = '#000';
  a.style.fontFamily = 'Tahoma';
  a.style.fontWeight = 'bold';
  a.style.margin = '10px 0 0 40px';
  a.appendChild(document.createTextNode('Customer#' + this._item.id));
  a.id = 'link' + this._prefix + '1';
  td.appendChild(a);
  
  tr = table.insertRow(-1);
  td = tr.insertCell(-1);
  td = tr.insertCell(-1);
  td.style.height = '120px';
  td.align = 'center';
  itable = document.createElement('table');
  itable.style.width = '650px';
  itable.style.height = '150px';
  itable.cellPadding = 0;
  itable.cellSpacing = 0;
  td.appendChild(itable);
  
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.style.width = '100px';
  itd.style.height = '20px';
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  img = document.createElement('img');
  img.src = 'images/pageasst/pagecustomers/order.png';
  itd.appendChild(img);
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.colSpan = 4;
  itd.style.height = '25px';
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  for (var i = 0, il = this._item.orders.length; i < il; i++) {
    var order = this._item.orders[i];
    span = document.createElement('span');
    span.style.fontSize = '15px';
    span.style.color = '#cc6600';
    span.style.fontFamily = 'Tahoma';
    span.style.fontWeight = 'bold';
    span.appendChild(document.createTextNode('(' + parseInt(1 + i) + ') ' + order.type + ' ( ' + ((order.createdDate == 0) ? 'no date' : SimpleDate.format(order.createdDate)) + ' )'));
    itd.appendChild(span);
    if (i < this._item.orders.length - 1) {
      img = document.createElement('img');
      img.src = 'images/pageasst/pagecustomers/line.png';
      img.style.margin = '0px 5px';
      itd.appendChild(img);
    }
  }
  
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.style.width = '160px';
  itd.style.height = '30px';
  itd.style.textAlign = 'left';
  img = document.createElement('img');
  img.src = 'images/pageasst/pagecustomers/bride.png';
  itd.appendChild(img);
  itd = itr.insertCell(-1);
  itd.style.width = '160px';
  itd.style.textAlign = 'left';
  img = document.createElement('img');
  img.src = 'images/pageasst/pagecustomers/tel.png';
  itd.appendChild(img);
  itd = itr.insertCell(-1);
  itd.style.width = '160px';
  itd.style.textAlign = 'left';
  img = document.createElement('img');
  img.src = 'images/pageasst/pagecustomers/mob.png';
  itd.appendChild(img);
  
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.style.verticalAlign = 'top';
  itd.style.height = '25px';
  itd.style.width = '150px';
  itd.style.textAlign = 'left';
  itd.style.fontSize = '12px';
  itd.style.color = '#996600';
  itd.style.fontFamily = 'Tahoma';
  itd.appendChild(document.createTextNode(this._item.bride.name));
  
  itd = itr.insertCell(-1);
  itd.style.verticalAlign = 'top';
  itd.style.width = '160px';
  itd.style.textAlign = 'left';
  itd.style.fontSize = '12px';
  itd.style.color = '#996600';
  itd.style.fontFamily = 'Tahoma';
  itd.appendChild(document.createTextNode(this._item.bride.phone));
  
  itd = itr.insertCell(-1);
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  itd.style.fontSize = '12px';
  itd.style.color = '#996600';
  itd.style.fontFamily = 'Tahoma';
  itd.appendChild(document.createTextNode(this._item.bride.mobile));
  
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.style.width = '160px';
  itd.style.textAlign = 'left';
  img = document.createElement('img');
  img.src = 'images/pageasst/pagecustomers/groom.png';
  itd.appendChild(img);
  itd = itr.insertCell(-1);
  itd.style.width = '160px';
  itd.style.textAlign = 'left';
  img = document.createElement('img');
  img.src = 'images/pageasst/pagecustomers/tel.png';
  itd.appendChild(img);
  itd = itr.insertCell(-1);
  itd.style.width = '160px';
  itd.style.textAlign = 'left';
  img = document.createElement('img');
  img.src = 'images/pageasst/pagecustomers/mob.png';
  itd.appendChild(img);
  itr = itable.insertRow(-1);
  itd = itr.insertCell(-1);
  itd.style.width = '150px';
  itd.style.verticalAlign = 'top';
  itd.style.height = '25px';
  itd.style.textAlign = 'left';
  itd.style.fontSize = '12px';
  itd.style.color = '#996600';
  itd.style.fontFamily = 'Tahoma';
  itd.appendChild(document.createTextNode(this._item.groom.name));
  itd = itr.insertCell(-1);
  itd.style.width = '150px';
  itd.style.verticalAlign = 'top';
  itd.style.textAlign = 'left';
  itd.style.fontSize = '12px';
  itd.style.color = '#996600';
  itd.style.fontFamily = 'Tahoma';
  itd.appendChild(document.createTextNode(this._item.groom.phone));
  itd = itr.insertCell(-1);
  itd.style.textAlign = 'left';
  itd.style.verticalAlign = 'top';
  itd.style.fontSize = '12px';
  itd.style.color = '#996600';
  itd.style.fontFamily = 'Tahoma';
  itd.appendChild(document.createTextNode(this._item.groom.mobile));
  
  tr = table.insertRow(-1);
  td = tr.insertCell(-1);
  td = tr.insertCell(-1);
  td.style.textAlign = 'right';
  td.style.verticalAlign = 'middle';
  td.style.height = '40px';
  td.style.fontSize = '12px';
  td.style.color = '#000';
  td.style.fontFamily = 'Tahoma';
  td.style.padding = '0 55px 0 0';
  td.appendChild(document.createTextNode('Created on'));
  span = document.createElement('span');
  span.style.fontSize = '12px';
  span.style.color = '#996600';
  span.style.fontFamily = 'Tahoma';
  span.appendChild(document.createTextNode(' ' + SimpleDate.format(this._item.createdDate)));
  td.appendChild(span);
  td.appendChild(document.createTextNode(' By ' ));
  span = document.createElement('span');
  span.style.fontSize = '12px';
  span.style.color = '#996600';
  span.style.fontFamily = 'Tahoma';
  span.appendChild(document.createTextNode(' ' + ((this._item.sales) ? this._item.sales.account : 'none')));
  td.appendChild(span);
  
  var bottom = document.createElement('table');
  bottom.style.backgroundImage = 'url(images/pageasst/pagecustomers/bottombg.png)';
  bottom.style.backgroundRepeat = 'no-repeat';
  bottom.style.width = '831px';
  bottom.style.height = '15px';
  bottom.cellPadding = 0;
  bottom.cellSpacing = 0;
  tableCell.appendChild(bottom);
};